import pytest
def add(x,y):
    return x+y
#定义一个变量
data = [
    (1,1,2),
    (1,2,3),
    
]
# 定义测试用例类
class TestAdd:
    @pytest.mark.parametrize('a,b,expect',data)
    def test_add(self,a,b,expect):
        result = add(a,b)
        assert result == expect
if __name__ == '__main__':
    pytest.main(['-s','hm_09_参数化_方法2.py'])